<%-- 
    Document   : FriendsPage
    Created on : 30.04.2011, 23:17:55
    Author     : ain
--%>

<%@page import="unc.pds.filemodel.FolderRemote"%>
<%@page import="unc.pds.model.DiaryRemote"%>
<%@page import="unc.pds.model.UserRemote"%>
<%@page import="unc.pds.data.Consts"%>
<%@page import="unc.pds.util.ArchImpl"%>
<%@page import="unc.pds.util.Arch"%>
<%@page import="unc.pds.service.*"%>
<%@page import="javax.naming.InitialContext"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Folders</title>
    </head>
    <body>
        <%
                    ServiceBeanRemote sbr = (ServiceBeanRemote) session.getAttribute("service");
                    UserRemote user = sbr.getUser();
                    UserRemote[] fs = user.getFriends();
                    for (int i = 0; i < fs.length; i++) {
                        out.println(
                                "<a href=FriendPage.jsp?id=" + fs[i].getKey() + ">"
                                + fs[i].getNickname() +
                                "</a><br>");
                    }
        %>
        <form action="FriendsPage.jsp">
            <input type="text" name="userKey" value="1">
            <input type="submit" name="newpost" value="newpost">
        </form>
        <%
                    if (request.getParameter("newpost") != null) {
                        user.sendInviteTo(new Long(Long.parseLong(request.getParameter("userKey"))));
                        response.sendRedirect("FriendPage.jsp?id=" + user.getKey());
                    }
        %>
    </body>
</html>
